package com.hxzy;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.util.Date;

public class JWTTest {
    public static void main(String[] args) {
//        long currentTimeMillis = System.currentTimeMillis();
//        Date date = new Date(currentTimeMillis);
//        JwtBuilder builder= Jwts.builder()
//                .setId("888")   //设置唯一编号
//                .setSubject("小白")//设置主题  可以是JSON数据
//                .setIssuedAt(new Date())//设置签发日期
////                .setExpiration(date)
//                .claim("roles","admin")//设置角色
//                .signWith(SignatureAlgorithm.HS256,"hxzy");//设置签名 使用HS256算法，并设置SecretKey(字符串)
//        //构建 并返回一个字符串
//        System.out.println( builder.compact() );

        String info = "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI4ODgiLCJzdWIiOiLlsI_nmb0iLCJpYXQiOjE2MzUzODkwNDAsInJvbGVzIjoiYWRtaW4ifQ.v5twwvCD7SHQPZUjyXGlozn9Bh_VNnARXtiElpZxQQk";
        Claims claims = Jwts.parser().setSigningKey("hxzy").parseClaimsJws(info).getBody();
        System.out.println(claims);
        System.out.println(new Date().getTime());
        //1635388244
        //1635388419512

    }
}

/*
BIDUPSID=E29949A1D2C82184D191E0FF13260B23;
PSTM=1575449057;
BAIDUID=7CC2F2F6A5BA91DD921ED087D832F243:FG=1;
__yjs_duid=1_817c52dd74ce5b77fb908215042c0b4a1619342353248;
BDUSS=kxa2JCeVJ1ejNuRzhhZ05-OW1vampJVFhtbTNvUDJVQ0w3SUpHWjJvN0toLWxnRVFBQUFBJCQAAAAAAAAAAAEAAACCDaIvurrX0zAwMTAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMr6wWDK-sFgfk;
BDUSS_BFESS=kxa2JCeVJ1ejNuRzhhZ05-OW1vampJVFhtbTNvUDJVQ0w3SUpHWjJvN0toLWxnRVFBQUFBJCQAAAAAAAAAAAEAAACCDaIvurrX0zAwMTAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMr6wWDK-sFgfk;
H_WISE_SIDS=110085_114553_127969_168388_173636_174662_175755_176120_176553_176678_177062_177168_177414_177950_177955_178330_178381_178630_178703_178731_178754_178852_178895_178947_178993_179201_179350_179365_179368_179401_179469_179476_179520_179575_179595_180063_180093_180110_180118_180324_180326_180327_180364_180566_180600_180616_180654_180699_180702_180744_180752_180754_180758_180823_180890_180931; BD_UPN=12314353;
BDORZ=B490B5EBF6F3CD402E515D22BCDA1598;
ispeed_lsm=0; delPer=0; BD_CK_SAM=1;
PSINO=6;
COOKIE_SESSION=1482_0_9_9_7_7_0_0_9_7_0_0_1482_0_83_0_1635385823_0_1635385740%7C9%230_0_1635385740%7C1;
BD_HOME=1; BA_HECTOR=008h24058021a0843t1gnk3df0q;
BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0;
H_PS_PSSID=34944_34067_31254_34864_34584_34517_34830_34916_34813_26350_22160;
BDSVRTM=29;
WWW_ST=1635388868624
 */